package com.starchen.optimalselection.product.controller;

import org.springframework.web.bind.annotation.*;

/**
 * 商品库存
 *
 * @author daxilong
 * @email daxilong@gmail.com
 * @date 2022-08-15 00:10:15
 */
@RestController
@RequestMapping("ware/waresku")
public class WareSkuController {

//    @Autowired
//    private WareSkuService wareSkuService;

    /**
     * 列表
     */
    /*
    @RequestMapping("/page")
    public Result list(WareSkuForm params){
        ResultPage page = wareSkuService.queryPage(params);

        return Result.success(page);
    }

    @RequestMapping("/info/{id}")
    public Result info(@PathVariable("id") Long id){
        WareSku wareSku = wareSkuService.getById(id);
        return Result.success(wareSku);
    }

    @RequestMapping("/create")
    public Result save(@RequestBody WareSku wareSku){
        wareSkuService.save(wareSku);
        return Result.success();
    }

    @RequestMapping("/update")
    public Result update(@RequestBody WareSku wareSku){
        wareSkuService.updateById(wareSku);
        return Result.success();
    }

    @RequestMapping("/delete")
    public Result delete(@RequestBody Long[] ids){
        wareSkuService.removeByIds(Arrays.asList(ids));
        return Result.success();
    }

    @RequestMapping("/hasstock")
    public Result getSkusHasStock(@RequestBody List<Long> skuIds) {
//        List<SkuStockTO> skuStockTOS = wareSkuService.getSkusStock(skuIds);
//        R ok = R.ok();
//        ok.setData(skuStockTOS);
//        List<SkuHasStockVo> list = wareSkuService.getSkusHasStock(skuIds);
//        Result<List<SkuHasStockVo>> r = Result.success();
//        r.setData(list);
        return null;
    }
*/
    /*
    @RequestMapping("/stock/batch")
    public Result<List<SkuStockTO>> getSkuStockBatch(@RequestBody List<Long> skuIds) {
        List<SkuStockTO> skuStockTOS = wareSkuService.getSkusStock(skuIds);
        Result result = Result.success();
        result.setData(skuStockTOS);
        return result;
    }

    @RequestMapping("/stock/{skuId}")
    public R getSkuStock(@PathVariable("skuId") Long skuId) {
        Long stock  = wareSkuService.getSkuStock(skuId);
        return R.ok().setData(stock);
    }
    */

    /*
     // 为订单锁定库存
    @PostMapping("/lockStock")
    public R lockStock(@RequestBody OrderLockStockTO lockStockTO) {
        wareSkuService.lockOrderStock(lockStockTO);
        return R.ok();
    }
    */
}
